package com.isky.visual.db.controller;


import com.isky.visual.db.entity.MetaData;
import com.isky.visual.db.service.IMetaDataService;
import com.isky.visual.result.ResultVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.List;

/**
 * <p>
 * 元数据表 前端控制器
 * </p>
 *
 * @author wudl
 * @since 2020-04-15
 */
//@RestController
//@RequestMapping("/db/metadata")
//@Api(tags = {"元数据相关接口"})
public class MetaDataController {


    @Autowired
    IMetaDataService metaDataService;

    @PostMapping(value = "/addMetadata")
    @ApiOperation("添加数据源")
    public ResultVo<String> addMetadata(HttpServletResponse response, @Valid MetaData metaData) {
        return metaDataService.addMetaData(metaData);
    }

    @PostMapping(value = "/delMetaData")
    @ApiOperation("删除元数据源")
    public ResultVo<String> delMetaData(HttpServletResponse response, @Valid MetaData metaData) {
        return metaDataService.delMetaData(metaData);
    }

    @PostMapping(value = "/updateMetaData")
    @ApiOperation("更新元数据")
    public ResultVo<String> updateMetaData(HttpServletResponse response, @Valid MetaData metaData) {
        return metaDataService.updateMetaData(metaData);
    }

    @PostMapping(value = "/queryMetaData")
    @ApiOperation("查询数据")
    public ResultVo<List<MetaData>> queryMetaData(HttpServletResponse response, @Valid MetaData metaData) {
        return metaDataService.queryMetaData(metaData);
    }


}
